package com.base.mvp;


import android.os.Bundle;
import android.support.annotation.Nullable;

import com.base.fragment.BaseFragment;

import javax.inject.Inject;

/**
 * Created by WuXiaolong on 2016/3/30.
 * github:https://github.com/WuXiaolong/
 * weibo:http://weibo.com/u/2175011601
 * 微信公众号：吴小龙同学
 * 个人博客：http://wuxiaolong.me/
 */
public abstract class MvpFragment<V extends BaseView,P extends BasePresenter> extends BaseFragment {

    @Inject
    protected P mPresenter;

//    @Override
//    public void onViewCreated(View view, Bundle savedInstanceState) {
//        super.onViewCreated(view, savedInstanceState);
//        mvpPresenter = createPresenter();
//    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        mvpPresenter = createPresenter();
        mPresenter.attachView((V) this);
    }

//    protected abstract P createPresenter();


    @Override
    public void onDestroyView() {
        super.onDestroyView();
        if (mPresenter != null) {
            mPresenter.detachView();
        }
    }
}
